package com.itwxz.forum.controller.mobile;

import cn.dev33.satoken.annotation.SaIgnore;
import cn.dev33.satoken.stp.StpUtil;
import cn.dev33.satoken.util.SaResult;
import com.itwxz.forum.domain.dto.LoginForumDto;
import com.itwxz.forum.service.ForumLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/forum/mobile")
public class ForumLoginController {
	@Autowired
	private ForumLoginService loginService;

	@SaIgnore
	@PostMapping("/login")
	public SaResult login(@RequestBody LoginForumDto user) {
		return loginService.login(user);
	}

	@GetMapping("/exit")
	public SaResult exitForumUser() {
		StpUtil.logout();
		return SaResult.ok("退出成功");
	}
}
